unit uMainForm;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Memo1: TMemo;
    lbTableName: TListBox;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    function getTableName: String;
    { Private declarations }
  public
    property TableName: String Read getTableName;
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation
uses usitools;

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
  myTable: TMyTable;
begin
  MyTable := TMyTable.Create;
  try
    myTable.TableName := TableName;
    memo1.Lines.Text := MyTable.SQL_SYMBOL;
  finally
    FreeAndNil(MyTable);
  end;
end;

procedure TForm1.Button2Click(Sender: TObject);
var
  myTable: TMyTable;
begin
  MyTable := TMyTable.Create;
  try
    lbTableName.Items := MyTable.Tables;
  finally
    FreeAndNil(MyTable);
  end;
end;

function TForm1.getTableName: String;
begin
  Result := '';
  if lbTableName.ItemIndex = -1 then exit;
  
  Result := lbTableName.Items[lbTableName.ItemIndex];
end;

end.

